package cn.ad.enumration;

import java.util.Map;

public enum Operator {
	UNKOWN("其它",0), 
    CMC("移动",1),  //移动
    CUC("联通",2),  //联通
    CTC("电信",3);  //电信

    private String name;
    private int value;

	private static java.util.HashMap<Integer,String> mappings;

	private synchronized static java.util.HashMap<Integer,String> getMappings() {
		if (mappings == null) {
			mappings = new java.util.LinkedHashMap<Integer,String>();
			for (Operator format : Operator.values()) {
				mappings.put(format.value,format.name); 
			}
		}
		return mappings;
	}
    
    private Operator(String name, int value) {
        this.name = name;
        this.value = value;
    }

    public String getName() {
        return name;
    }

	public int getValue() {
		return value;
	}
	
	public static String forValue(int value) {
		return getMappings().get(value);
	}
	
	public static Map<Integer,String> getMapping() {
		return getMappings();
	}
}
